<?php

namespace App\Admin\Forms\User;

use App\Wen\Utils\FieldUtils;
use App\Wen\Utils\Settings;
use App\Wen\Utils\SiteUtils;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;

class userWithdrawalForm extends Form implements LazyRenderable
{
    use LazyWidget;

    public function handle(array $input)
    {
        SiteUtils::forget_config_data();
        Settings::set('user_withdrawal_type', $input['user_withdrawal_type'], true);

        return $this->response()
            ->success('配置成功')
            ->refresh();
    }

    public function form()
    {
        $this->radio('user_withdrawal_type', '提现方式')->options([0=>'银行卡', 1=>'微信手机号', 2=>'支付宝手机号'])->default(Settings::get('user_withdrawal_type', 0));
    }
}
